<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:slctrls="http://schemas.xceed.com/silverlight/xaml/controls">

   <LinearGradientBrush x:Key="silverlightListBoxGroupHearderItemBackgroundBrush"
                        EndPoint="0.5,1"
                        StartPoint="0.5,0">
      <GradientStop Color="#EBEDEF"
                    Offset="1" />

      <GradientStop Color="#FBFBFB"
                    Offset="0" />
   </LinearGradientBrush>

   <LinearGradientBrush x:Key="silverlightListBoxDefaultBorderBrush"
                        EndPoint="0.5,1"
                        StartPoint="0.5,0">
      <GradientStop Color="#FFA3AEB9"
                    Offset="0" />
      <GradientStop Color="#FF8399A9"
                    Offset="0.375" />
      <GradientStop Color="#FF718597"
                    Offset="0.375" />
      <GradientStop Color="#FF617584"
                    Offset="1" />
   </LinearGradientBrush>

   <LinearGradientBrush x:Key="silverlightGroupNavigationControlButtonPressedBackgroundBrush"
                        StartPoint="0.5,0"
                        EndPoint="0.5,1.04">
      <GradientStop Color="#FFe1ecf6"
                    Offset="0" />

      <GradientStop Color="#FFd5e5f2"
                    Offset="0.3" />

      <GradientStop Color="#FFaecee8"
                    Offset="0.5" />

      <GradientStop Color="#FF75abd8"
                    Offset="1" />
   </LinearGradientBrush>

   <LinearGradientBrush x:Key="silverlightGroupNavigationControlButtonDefaultBorderBrush"
                        EndPoint="0.5,1"
                        StartPoint="0.5,0">
      <GradientStop Color="#FFCFD0D0"
                    Offset="0" />

      <GradientStop Color="#FFC9CACA"
                    Offset="1" />
   </LinearGradientBrush>

   <LinearGradientBrush x:Key="silverlightGroupNavigationControlButtonDefaultBackgroundBrush"
                        StartPoint="0.5,0"
                        EndPoint="0.5,1">
      <GradientStop Color="#FFFBFBFB"
                    Offset="0" />

      <GradientStop Color="#FFD6DBDF"
                    Offset="1" />
   </LinearGradientBrush>

   <slctrls:DividendDivisorToCeilingQuotientConverter x:Key="dividendDivisorToCeilingQuotientConverter" />

   <!--**************************
    * TEMPLATE: WatermarkTextBox
    ************************** -->
   <ControlTemplate x:Key="watermarkTextBoxTemplate"
                    TargetType="slctrls:WatermarkTextBox">

      <Border x:Name="MouseOverBorder"
              BorderThickness="1"
              BorderBrush="Transparent">

         <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="CommonStates">
               <VisualState x:Name="Normal" />
               <VisualState x:Name="MouseOver">
                  <Storyboard>
                     <ColorAnimation Storyboard.TargetName="MouseOverBorder"
                                     Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
                                     To="#FF99C1E2"
                                     Duration="0" />
                  </Storyboard>
               </VisualState>
            </VisualStateGroup>

            <VisualStateGroup x:Name="WatermarkStates">
               <VisualState x:Name="WatermarkVisible">
                  <Storyboard>
                     <DoubleAnimation Storyboard.TargetName="WatermarkPresenter"
                                      Storyboard.TargetProperty="Opacity"
                                      To="0.7"
                                      Duration="0" />
                  </Storyboard>
               </VisualState>

               <VisualState x:Name="WatermarkHidden">
                  <Storyboard>
                     <DoubleAnimation Storyboard.TargetName="WatermarkPresenter"
                                      Storyboard.TargetProperty="Opacity"
                                      To="0"
                                      Duration="0" />
                  </Storyboard>
               </VisualState>
            </VisualStateGroup>

         </VisualStateManager.VisualStateGroups>

         <Grid>
            <ScrollViewer x:Name="ContentElement"
                          Padding="{TemplateBinding Padding}"
                          BorderThickness="0"
                          IsTabStop="False" />

            <ContentPresenter x:Name="WatermarkPresenter"
                              IsHitTestVisible="False"
                              Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=WatermarkContent, Mode=OneWay}"
                              ContentTemplate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=WatermarkContentTemplate, Mode=OneWay}"/>
         </Grid>

      </Border>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: DataNavigationControl
    ************************** -->
   <ControlTemplate x:Key="dataNavigationControlTemplate"
                    TargetType="slctrls:DataNavigationControl">

      <Border Margin="{TemplateBinding Padding}">

         <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="CommonStates">
               <VisualState x:Name="Normal" />
               <VisualState x:Name="Disabled" >
                  <Storyboard>
                     <DoubleAnimation Storyboard.TargetName="DataPresenter"
                                      Storyboard.TargetProperty="Opacity"
                                      Duration="0"
                                      To=".55" />
                  </Storyboard>
               </VisualState>
               <VisualState x:Name="MouseOver" />
            </VisualStateGroup>

            <VisualStateGroup x:Name="FocusStates">
               <VisualState x:Name="Unfocused" />
               <VisualState x:Name="Focused" />
            </VisualStateGroup>
         </VisualStateManager.VisualStateGroups>
         <Grid>
            <ItemsPresenter x:Name="DataPresenter" />
         </Grid>
      </Border>
   </ControlTemplate>

   <!--**************************
    * TEMPLATE: DataNavigationItem
    ************************** -->
   <ControlTemplate x:Key="dataNavigationItemTemplate"
                    TargetType="slctrls:DataNavigationItem">
      <Grid x:Name="grid">
         <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="CommonStates">
               <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="00:00:00.200" />

                  <VisualTransition From="MouseOver"
                                    To="Pressed" />
               </VisualStateGroup.Transitions>

               <VisualState x:Name="Normal" />

               <VisualState x:Name="MouseOver">
                  <Storyboard>
                     <DoubleAnimation Duration="00:00:00.000"
                                      To="1"
                                      Storyboard.TargetProperty="(UIElement.Opacity)"
                                      Storyboard.TargetName="Over" />
                  </Storyboard>
               </VisualState>

               <VisualState x:Name="Pressed">
                  <Storyboard>
                     <DoubleAnimation Duration="00:00:00.000"
                                      To="1"
                                      Storyboard.TargetProperty="(UIElement.Opacity)"
                                      Storyboard.TargetName="Pressed1" />
                  </Storyboard>
               </VisualState>

               <VisualState x:Name="Disabled">
                  <Storyboard>
                     <DoubleAnimation Duration="00:00:00.000"
                                      To="0.5"
                                      Storyboard.TargetProperty="(UIElement.Opacity)"
                                      Storyboard.TargetName="grid" />
                  </Storyboard>
               </VisualState>
            </VisualStateGroup>

            <VisualStateGroup x:Name="FocusStates">
               <VisualState x:Name="Focused" />

               <VisualState x:Name="Unfocused" />
            </VisualStateGroup>
         </VisualStateManager.VisualStateGroups>

         <Border x:Name="Background"
                 BorderThickness="1"
                 BorderBrush="{StaticResource silverlightGroupNavigationControlButtonDefaultBorderBrush}"
                 Background="{StaticResource silverlightGroupNavigationControlButtonDefaultBackgroundBrush}" />

         <Border x:Name="Over"
                 Opacity="0"
                 BorderThickness="1">
            <Border.Background>
               <LinearGradientBrush StartPoint="0.5,0"
                                    EndPoint="0.5,1">
                  <GradientStop Color="#FFfbfcfd"
                                Offset="0" />

                  <GradientStop Color="#FFeef4f9"
                                Offset="0.36" />

                  <GradientStop Color="#FFa4c7e5"
                                Offset="1" />
               </LinearGradientBrush>
            </Border.Background>
         </Border>

         <Border x:Name="Pressed1"
                 Opacity="0"
                 BorderThickness="1"
                 Background="{StaticResource silverlightGroupNavigationControlButtonPressedBackgroundBrush}" />

         <ContentPresenter x:Name="contentPresenter"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center"
                           Content="{Binding}"
                           ContentTemplate="{TemplateBinding ContentTemplate}"
                           Margin="{TemplateBinding Padding}" />
      </Grid>
   </ControlTemplate>

   <!--**************************
    * STYLE: WatermarkTextBox
    ************************** -->
   <Style TargetType="slctrls:WatermarkTextBox">
      <Setter Property="Template"
              Value="{StaticResource watermarkTextBoxTemplate}" />
   </Style>

   <!--**************************
    * Style: DataNavigationControl
    ************************** -->
   <Style TargetType="slctrls:DataNavigationControl">
      <Setter Property="Background"
              Value="{StaticResource silverlightListBoxGroupHearderItemBackgroundBrush}"/>

      <Setter Property="ItemsPanel">
         <Setter.Value>
            <ItemsPanelTemplate>
               <slctrls:UniformGrid x:Name="KeysHost"
                                    Orientation="Horizontal"
                                    Columns="5"
                                    Rows="{Binding RelativeSource={RelativeSource Self}, Path=Children.Count, Converter={StaticResource dividendDivisorToCeilingQuotientConverter}, ConverterParameter=5}" />
            </ItemsPanelTemplate>
         </Setter.Value>
      </Setter>

      <Setter Property="Template"
              Value="{StaticResource dataNavigationControlTemplate}"/>
   </Style>

   <!--**************************
    * STYLE: DataNavigationItem
    ************************** -->
   <Style TargetType="slctrls:DataNavigationItem">

      <Setter Property="IsTabStop"
              Value="False"/>

      <Setter Property="HorizontalContentAlignment"
              Value="Center" />

      <Setter Property="VerticalContentAlignment"
              Value="Center" />

      <Setter Property="Background"
              Value="{StaticResource silverlightListBoxGroupHearderItemBackgroundBrush}" />

      <Setter Property="BorderBrush"
              Value="{StaticResource silverlightListBoxDefaultBorderBrush}" />

      <Setter Property="BorderThickness"
              Value="1" />

      <Setter Property="Margin"
              Value="3" />

      <Setter Property="Foreground"
              Value="Black" />

      <Setter Property="Template"
              Value="{StaticResource dataNavigationItemTemplate}"/>
   </Style>


</ResourceDictionary>
